/*
 * AbstractVertex.java
 *
 * Created on 2007年10月12日, 下午9:24
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package com.exclamation.util.graph;

/**
 *
 * @author littlerock
 */
public abstract class AbstractVertex implements Vertex {

    protected int id;
    protected Object value;

    /** Creates a new instance of AbstractVertex */
    protected AbstractVertex(int id) {
        this(id, null);
    }

    protected AbstractVertex(int id, Object value) {
        this.id = id;
        this.value = value;
    }

    public int getId() {
        return this.id;
    }

    public Object getValue() {
        return this.value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public boolean equals(Object o) {
        if (o == null) {
            return false;
        }
        if (o instanceof Vertex) {
            Vertex v = (Vertex) o;
            if (v.getGraph() == this.getGraph() && v.getId() == this.getId()) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
}


